﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ControlOtrosDocumentos.ascx.cs"
    Inherits="WebArchivosTelefonica.Jerarquias.ControlOtrosDocumentos" %>
<div>
    <asp:Repeater ID="_barraBotones" runat="server" OnItemCommand="_barraBotones_ItemCommand">
        <HeaderTemplate>
            <table>
                <tr>
        </HeaderTemplate>
        <ItemTemplate>
            <td>
                <asp:Button ID="_botonPestañaDataSource" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"TextoBoton")%>'
                    BorderColor="#999999" BorderStyle="Solid" BorderWidth="2px" BackColor="#6699FF"
                    Width="99px" Font-Bold="True" Font-Size="X-Small" Font-Names="Verdana" UseSubmitBehavior="False"
                    CommandName="Seleccionar" />
                <asp:HiddenField ID="_hiddenFieldId" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"IdCarpeta") %>' />
                <asp:HiddenField ID="_hiddenFieldNombreCarpeta" runat="server" Value='<%#DataBinder.Eval(Container.DataItem, "NombreCarpeta") %>' />
            </td>
        </ItemTemplate>
        <FooterTemplate>
            </tr> </table>
        </FooterTemplate>
    </asp:Repeater>
    <center>
        <asp:GridView ID="_gridViewOtrosDoc" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            CellPadding="4" DataKeyNames="Id,Nombre,Descripcion,Fecha" DataSourceID="_linqDataSourceOtrosDocumentos"
            ForeColor="#333333" GridLines="None" Width="100%" Font-Names="Verdana" Font-Size="X-Small"
            OnRowCommand="GridViewOtrosDoc_RowCommand" BorderWidth="2px" BorderColor="#999999">
            <FooterStyle BackColor="#6699ff" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#EFF3FB" BorderStyle="None" />
            <EmptyDataRowStyle BackColor="#507CD1" Font-Bold="True" HorizontalAlign="Right" VerticalAlign="Middle" />
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Actualizar"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancelar"></asp:LinkButton>
                    </EditItemTemplate>
                    <FooterTemplate>
                    </FooterTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="Editar"></asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="Borrar"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Nombre" HeaderText="Nombre" ReadOnly="True" SortExpression="Nombre" />
                <asp:TemplateField HeaderText="Descripcion" SortExpression="Descripcion">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Height="55px" Text='<%# Bind("Descripcion") %>'
                            TextMode="MultiLine" Width="100%"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Descripcion") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Fecha" HeaderText="Fecha" ReadOnly="True" SortExpression="Fecha" />
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageDescargar" runat="server" CommandArgument="<%# Container.DataItemIndex %>"
                            ImageUrl="~/Images/save16.ico" Visible='<%# Eval("ExisteDocumento") %>' CommandName="Ver" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <PagerStyle BackColor="#6699ff" ForeColor="Black" HorizontalAlign="Right" VerticalAlign="Middle" />
            <EmptyDataTemplate>
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#D1DDF1" BorderColor="Black" BorderStyle="Solid" Font-Bold="True"
                ForeColor="#333333" />
            <HeaderStyle BackColor="#6699ff" ForeColor="Black" Font-Bold="True" />
            <EditRowStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="True" BackColor="Silver" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
        <div style="background-color: #6699ff; vertical-align: middle;">
            <table style="width: 100%;">
                <tr>
                    <td style="vertical-align: super; text-align: left">
                        <asp:Label ID="LabelDocumento" runat="server" Text="Nuevo documento a subir: " Font-Names="Verdana"
                            Font-Size="X-Small"></asp:Label>
                        <asp:FileUpload ID="_fileUploadOtroDocumento" runat="server" Font-Names="Verdana"
                            Font-Size="X-Small" Height="22px" />
                        <asp:Button ID="ButtonAceptar" runat="server" Text="Subir" Font-Names="Verdana" Font-Size="X-Small"
                            Width="50px" OnClick="ButtonAceptar_Click" Height="22px" />
                    </td>
                    <td style="text-align: right; vertical-align: super">
                        <asp:Label ID="LabelDescripcion" runat="server" Text=" Descripcion: " Font-Names="Verdana"
                            Font-Size="X-Small"></asp:Label>
                        <asp:TextBox ID="_textBoxDescripcion" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
            </table>
        </div>
        <asp:LinqDataSource ID="_linqDataSourceOtrosDocumentos" runat="server" ContextTypeName="WebArchivosTelefonica.Jerarquias.DataClassesArbolDataContext"
            Where="JerarquiaCarpeta.Nombre == @NombreCarpetaBase &amp;&amp; AsociacionCandidatoDocumento.IdCandidato == Guid(@IdCandidato)"
            EnableDelete="True" EnableUpdate="True" TableName="Documentos" OrderBy="Consecutivo">
            <WhereParameters>
                <asp:ControlParameter ControlID="HiddenFieldIdCandidato" Name="IdCandidato" DefaultValue="00000000-0000-0000-0000-000000000000"
                    PropertyName="Value" />
                <asp:ControlParameter ControlID="HiddenFieldIdCarpetaBase" Name="IdCarpetaBase" PropertyName="Value" />
                <asp:ControlParameter ControlID="HiddenFieldNombreCarpetaOtros" Name="NombreCarpetaBase"
                    PropertyName="Value" />
            </WhereParameters>
        </asp:LinqDataSource>
        <asp:HiddenField ID="HiddenFieldIdCarpetaBase" runat="server" Value="00000000-0000-0000-0000-000000000000" />
        <asp:HiddenField ID="HiddenFieldIdCandidato" runat="server" Value="00000000-0000-0000-0000-000000000000" />
        <asp:HiddenField ID="HiddenFieldNombreCarpetaOtros" runat="server" />
    </center>
</div>
